Skip to content

Refactor LaTeX methods in catlog-wasm and catlog#1319

Open
tim-at-topos wants to merge 42 commits into
tim/mass-action-polynomial-ode-systemfrom
tim/refactor-wasm-analyses
Open

Refactor LaTeX methods in catlog-wasm and catlog#1319
tim-at-topos wants to merge 42 commits into
tim/mass-action-polynomial-ode-systemfrom
tim/refactor-wasm-analyses

Conversation

@tim-at-topos

@tim-at-topos tim-at-topos commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Stacked on #1251

Now that more ODE analyses have LaTeX equations, we should be stricter about the use of fmt::Display only for debugging.

This PR introduces some new types and traits (Latex, ToLatex, ToLatexWithMap) for dealing with LaTeX expressions and rendering object/morphism names nicely in the frontend. It also includes a bunch of tests for ODE semantics in the wasm layer. Finally, as a bonus, it removes a lot of repetitive code from catlog-wasm::src::analyses by defining ode_semantics_simulation and ode_semantics_equations, enabled by #1251, as well as removing some unnecessary types introduced there (such as LotkaVolterraEquationsData, which is just null).

Again, this refactor adds a lot of lines, but that's almost entirely due to how many nice new tests it adds 👼

As a bonus, this PR fixes the following issues:


Although further refactoring is possible (e.g. lotka_volterra.tsx and linear_ode.tsx share a lot of code), I think that the "correct" solution to this would be to start looking at generating that code from the definitions of the analyses rather than manually refactoring it. But this is now a much larger, rather separate project, so I think it's a bit out of scope.

With that in mind, I would suggest that this PR finally completes the last item in #1177 , and thus closes the RFC-0001 parent issue #1098.

WIP: Rethinking traits

WIP: Some tests only half failing

WIP: Tests passing; time to tidy

ENH: Build derived model of th_signed_polynomial_ode_system in mass_action

ENH: Mass-action for stock-flow; DEL: Mass-action for signed stock-flow

ENH: struct for transition / flow interfaces

WIP: Starting on Lotka-Volterra

WIP: Failing tests

FIX: Lotka-Volterra tests passing

FIX: Working analysis (frontend)

ENH: Lotka-Volterra equations

ENH: Linear ODE refactor

ENH: Linear ODE equations

WIP: Starting on ODESemantics

WIP: lotka_volterra_semantics()

WIP: build_system_from_ode_semantics

WIP: DblModelForODESemantics

WIP: ODESemanticsAnalysis and ODESemanticsProblemData

WIP: ODESemantics trait

WIP: Documentation

WIP: ODESemantics for mass-action

WIP: Cleaning up types, but mass-action still frustrating

WIP: Big reshuffle (moving functions out from a struct)

WIP: Fixing mass-action again

WIP: terrible code

WIP: Changed from ObGen to Ob

WIP: Stock-flow mass-action

FIX: Passing catlog tests

Rename LinearODE -> LCC

FIX: Documentation

TODO: Redesign
@tim-at-topos tim-at-topos force-pushed the tim/refactor-wasm-analyses branch from e71f793 to 7a8e39c Compare June 16, 2026 11:47
@tim-at-topos tim-at-topos force-pushed the tim/refactor-wasm-analyses branch from 343e557 to 46de547 Compare June 17, 2026 18:48
@tim-at-topos tim-at-topos force-pushed the tim/refactor-wasm-analyses branch from 3da1897 to b8071ee Compare June 18, 2026 17:23
@tim-at-topos tim-at-topos force-pushed the tim/refactor-wasm-analyses branch from d121fcf to 247bfa3 Compare June 19, 2026 17:42
@tim-at-topos tim-at-topos force-pushed the tim/mass-action-polynomial-ode-system branch from e7cf73f to d0a07a5 Compare June 25, 2026 18:17
@tim-at-topos tim-at-topos force-pushed the tim/refactor-wasm-analyses branch 3 times, most recently from 88df96c to d350cf7 Compare June 25, 2026 19:32
@tim-at-topos

Copy link
Copy Markdown
Contributor Author

@kasbah could you please help me to fix the failing npm checks?

  ⚠ solid(reactivity): The reactive variable 'props.config' should be used within JSX, a tracked scope (like createEffect), or inside an event handler function, or else changes will be ignored.
    ╭─[src/stdlib/analyses/mass_action_config_form.tsx:20:33]
 19 │     let correctConfig: MassActionEquationsData;
 20 │     if (isMassActionProblemData(props.config)) {
    ·                                 ────────────
 21 │         correctConfig = props.config.equationsData;
    ╰────

  ⚠ solid(reactivity): The reactive variable 'props.config.equationsData' should be used within JSX, a tracked scope (like createEffect), or inside an event handler function, or else changes will be ignored.
    ╭─[src/stdlib/analyses/mass_action_config_form.tsx:21:25]
 20 │     if (isMassActionProblemData(props.config)) {
 21 │         correctConfig = props.config.equationsData;
    ·                         ──────────────────────────
 22 │     } else {
    ╰────

  ⚠ solid(reactivity): The reactive variable 'props.config' should be used within JSX, a tracked scope (like createEffect), or inside an event handler function, or else changes will be ignored.
    ╭─[src/stdlib/analyses/mass_action_config_form.tsx:23:25]
 22 │     } else {
 23 │         correctConfig = props.config;
    ·                         ────────────
 24 │     }

@tim-at-topos tim-at-topos added frontend TypeScript frontend and Rust-wasm integrations tidying Refactoring or simplifying existing code labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend TypeScript frontend and Rust-wasm integrations tidying Refactoring or simplifying existing code

Projects

None yet

1 participant